# Tutorials from the zetcode.com website (http://zetcode.com/gui/pysidetutorial/firstprograms/)
# Shows how to create a window in procedural style. In next examples we will use object oriented style.

import sys
from PySide import QtGui                        # Basic GUI widgets are in the QtGui module

appObject = QtGui.QApplication(sys.argv)        # Every PySide application requires an application object
                                                # sys.argv contains the command line arguments
# The QWidget class is the base class of all interface objects in PySide.
# Providing the default constructor for QWidget.
mainWindow = QtGui.QWidget()        # Default constructor has no parent. Widget having no parent is called a window.
mainWindow.resize(250, 150)         # resize() - resizes the 'widget' (note: a window is also a parentless widget)
mainWindow.setWindowTitle("Simple Window")  # Set the title of the window
mainWindow.show()                   # Show the widget on the screen

# Finally we enter into the main loop of the application. Event handling starts from this point.
# The sys.exit() ensures a clean exit and the environment will be informed how the application has ended.
sys.exit(appObject.exec_())
